package com.zy.web.demo.duoxiancheng.demo6;

/**
 * @author <a href="mailto:zhouyong@cqyyt.com">zy</a>
 * @version 1.0
 * @date 2020/7/29 10:10
 * suspend暂停线程，resume恢复线程
 */
public class test6 {

    public static void main(String[] args) {
        try {
            MyThread thread = new MyThread();
            thread.start();
            thread.sleep(1000);
            //A段
            thread.suspend();
            System.out.println("A="+System.currentTimeMillis()+"i="+thread.getId());
            thread.sleep(5000);
            System.out.println("A="+System.currentTimeMillis()+"i="+thread.getId());
            //B段
            thread.resume();
            thread.sleep(5000);
            //C段
            thread.suspend();
            System.out.println("B="+System.currentTimeMillis()+"i="+thread.getId());
            thread.sleep(5000);
            System.out.println("B="+System.currentTimeMillis()+"i="+thread.getId());
        }catch (InterruptedException e){
            e.printStackTrace();
        }
    }

}
